import store from '@/store'
import router from '@/router'
import { Vue } from 'vue-class-component'
import home from '@/views/home/home'

export default class navigator extends Vue {
  token = ''
  account
  created () {
    if (store.state.token !== null) {
      this.token = store.state.token
      this.account = store.state.u.account
    }
  }

  login1 (): void {
    router.push({
      path: '/login'
    })
  }

  personCenter (): void {
    router.push('/basicInformation')
  }

  purse (): void {
    router.push('/purse')
  }

  set (): void {
    router.push('/set')
  }

  message (): void {
    router.push('/message')
  }

  logout (): void {
    store.commit('REMOVE_INFO')
    if (this.$route.path === '/home') {
      location.reload()
    } else {
      router.push('/home')
    }
  }
}
